package com.xuelang.pipeline.client.resource;

import com.xuelang.pipeline.client.common.request.PageParam;
import com.xuelang.pipeline.client.common.result.ApiResult;
import com.xuelang.pipeline.client.common.result.PageRecord;
import com.xuelang.pipeline.client.resource.dto.ToolChainDTO;
import com.xuelang.pipeline.client.resource.dto.ToolChainQuery;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;
import java.util.List;

/**
 * 工具链服务API
 *
 * @author xiwen.zxg
 * @since 2024/5/15
 */
public interface IToolChainService {

    /**
     * 查询工具链列表(有过滤条件，可以分页)
     *
     * @param dtoPageParam
     * @return
     */
    @PostMapping(value = "/pageList", produces = "application/json;charset=utf-8")
    ApiResult<PageRecord<ToolChainDTO>> pageToolChainList(@RequestBody @Valid PageParam<ToolChainQuery> dtoPageParam);

    /**
     * 查询工具链列表(有过滤条件)
     *
     * @param toolChainQuery
     * @return
     */
    @PostMapping(value = "/list", produces = "application/json;charset=utf-8")
    ApiResult<List<ToolChainDTO>> conditionalToolChainList(@RequestBody @Valid ToolChainQuery toolChainQuery);

    /**
     * 新增工具链
     *
     * @param toolChainDTO
     * @return
     */
    @PostMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> addToolChain(@RequestBody @Valid ToolChainDTO toolChainDTO);

    /**
     * 更新工具链
     *
     * @param toolChainDTO
     * @return
     */
    @PutMapping(value = "", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> updateToolChain(@RequestBody @Valid ToolChainDTO toolChainDTO);

    /**
     * 删除工具链
     *
     * @param code
     * @return
     */
    @DeleteMapping(value = "/{code}", produces = "application/json;charset=utf-8")
    ApiResult<Boolean> deleteToolChain(@PathVariable("code") String code);

    /**
     * 查询工具链
     *
     * @param code
     * @return
     */
    @GetMapping(value = "/{code}", produces = "application/json;charset=utf-8")
    ApiResult<ToolChainDTO> queryToolChain(@PathVariable("code") String code);

}
